import React, { Component } from 'react';
import config from '../../pages/list/config';
import { onSearchButtonClick } from '../../pages/list/events';
import { base, getMultiLang} from 'nc-lightapp-front';
import './index.less';
const  { NCTabs } = base;
let NCTabPane = NCTabs.NCTabPane;
class Search extends Component {
    constructor(props) {
        super(props);
        this.state = {
            listTabData: [
				{ title: '发票', key: '0' },
				{ title: '订单', key: '1' }
			],
            multiLang: {}
        }
    }
    render() {
        const { NCCreateSearch, that } = this.props;
        return (
            <div className='nc-singleTable-search'>
                <div className='nc-list-tabs'>
                    <NCTabs
                        onChange={(key) => {
                            that.setState({
                                showRotate: true
                            })
                            that.listTabStatus = key
                            that.initTempAndLang()
                            if(key === '0' && that.state.navTabStatus === '33') {
                                that.setBtnAllVisible(true)
                            }
                            if(key === '0' && (that.state.navTabStatus === '36' || that.state.navTabStatus === '39')) {
                                that.setBtnVisible(false)
                            }
                            if(key === '1' && that.state.navTabStatus === '33') {
                                that.setGoReimbursementBtnVisible(true)
                                that.setOrderBtnVisible(false)
                            }
                            if(key === '1' && (that.state.navTabStatus === '36' || that.state.navTabStatus === '39')) {
                                that.setBtnAllVisible(false)
                            }
                        }}
                        animated={false}
                    >
                        {this.state.listTabData.map((item, index) => {
                            return (
                                <NCTabPane tab={item.title} key={item.key}>
                                    {/* {this.getHtmlMainRender(params, item)} */}
                                </NCTabPane>
                            )
                        })}
                    </NCTabs>
                </div>
                <div className='nc-singleTable-search-area'>
                    {that.listTabStatus === '0'&& NCCreateSearch(config.orderConfig.searchArea, { 
                        clickSearchBtn: onSearchButtonClick.bind(that),
                        clickPlanEve: onSearchButtonClick.bind(that),
                        useCache: false
                    })}
                    {that.listTabStatus === '1'&& NCCreateSearch(config.orderConfig.searchArea, { 
                        clickSearchBtn: onSearchButtonClick.bind(that),
                        clickPlanEve: onSearchButtonClick.bind(that),
                        useCache: false
                    })}
                </div>
            </div>
        )
    }
}
export default Search;